package org.telegram.bot.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.telegram.bot.domain.BotBanEmoji;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * 违禁情Mapper接口
 *
 * @author wyx
 * @date 2024-11-30
 */
public interface BotBanEmojiMapper extends BaseMapper<BotBanEmoji>
{

    /**
     * 查询违禁情列表
     *
     * @param botBanEmoji 违禁情
     * @return 违禁情集合
     */
    public List<BotBanEmoji> selectBotBanEmojiList(BotBanEmoji botBanEmoji);
    
    /**
     * 获取表情列表
     * @param chatId
     * @return
     */
    default Set<String> emojiList(Long chatId){
        LambdaQueryWrapper<BotBanEmoji> queryWrapper = new LambdaQueryWrapper<>();
        if(chatId!=null){
            queryWrapper.eq(BotBanEmoji::getChatId, chatId);
        }
        return selectList(queryWrapper).stream().map(BotBanEmoji::getEmoji).collect(Collectors.toSet());
    }
}
